Skip to content

Record the page and a screenshot when a journey fails - #44

Merged
Mpdreamz merged 3 commits into
mainfrom
feat/failure-screenshot-and-output
Nov 10, 2026
Merged

Mpdreamz merged 3 commits into
mainfrom
feat/failure-screenshot-and-output

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

A failing journey now carries the URL of the page it stopped on and a PNG of the viewport, and cdp run prints less noise for the same run.

Why

JourneyFailure held a line, a command and a message. A host running journeys against a live site (docs-builder's docs-journeys, and the TUnit tests through Nullean.Snapshots) could say which step broke and nothing about what the page looked like. cdp run also fenced every unmet feature block and printed a refused request once per occurrence.

What

A failure records the page

JourneyFailure gains Url, Screenshot and ScreenshotPath. The runner takes the capture before it disposes the context, with a 5 second limit, and a page that is gone leaves them out. With an artifacts folder the PNG is written to failure.png. JourneyOptions.ScreenshotOnFailure (default true) turns it off. Describe adds Page: and Screenshot: lines, so the TUnit message and the CLI say the same.

cdp run prints less

An unmet feature block is one line with its reason and no fence, marked by the new Checkpoint.IsSkip so page text cannot imitate it. A repeated refused request is listed once with (xN). A failure puts url: inside the fence with the message, and prints -- screenshot: <path> outside it, since the host chose the path. The fence stays on for every output: a terminal is no proof that a person is reading.

Existing tests

Three tests compared a whole JourneyFailure with Should().Be. They now compare line, command and message, because the record also holds the page.

Verify

dotnet test -c Release

Breaking the capture (Screenshot = null) fails two runner tests, and removing the IsSkip branch fails the CLI skip test.

Out of scope: no release. docs-builder picks this up once a version is tagged.

🤖 Generated with Claude Code

Mpdreamz and others added 3 commits November 10, 2026 19:21
…cdp run output

A failing journey now carries the page's URL and a PNG of the viewport, written to failure.png in the artifacts folder when there is one. JourneyFailure.Describe adds them as Page and Screenshot lines, so a test host and the CLI show the same thing. ScreenshotOnFailure turns the capture off.

The CLI still fences everything from the page. An unmet feature block is one line with its reason, and a refused request that repeats is listed once with its count.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A screenshot can show private data on a page, so it is taken only with ScreenshotOnFailure or --screenshot-on-failure. The failure still records the page's URL.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The CLI prints no image, so a capture with nowhere to go was taken and thrown away.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz merged commit 89ee4b8 into main Nov 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant